from http.client import responses
from random import random
from urllib.error import HTTPError

from django.conf import settings
from django.core.mail import send_mail



def send_email(email,code):
    # 生成 10000 到 99999 之间的随机整数

    try:
        response=send_mail('xx网站登录/注册验证码','验证码为：{}'.format(code),settings.EMAIL_HOST_USER,[email,])
    except HTTPError as e:
        response = {'result':1000,'errmsg':'网络错误发送失败'}

    # 返回1 表示发送成功
    return response
